#!/usr/bin/env python

# Copyright 2011 - 2012 David Selby dave6502@gmail.com

# This file is part of FX Wizard.

# FX Wizard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# FX Wizard is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with FX Wizard.  If not, see <http://www.gnu.org/licenses/>.


import os, sys, subprocess, pickle

# install = {}
# install['version_str'] = 'v1.01 Alpha'
# install['fx_wizard_dir'] = os.path.dirname(os.path.abspath(__file__))

# need to find 'MyMobiler.exe', it does not install properly so there so there
# is no fixed location, try searching 'Documents ans Settings' first
my_mobiler = subprocess.Popen(r'cd \Documents and Settings & dir MyMobiler.exe /S /B', 
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()

# else its the whole drive, could take some time
if 'File Not Found' in my_mobiler[1]:
	my_mobiler = subprocess.Popen(r'cd \ & dir MyMobiler.exe /S /B', 
	stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()

if 'File Not Found' in my_mobiler[1]:
	print '*ERROR* my mobiler not found'
	sys.exit()

# install['my_mobiler_dir'] = os.path.dirname(my_mobiler[0])

# f_obj = open('core/install.pik', 'wb')
# pickle.dump(install, f_obj)
# f_obj.close()




